

function editPhoto(photoId) {
	// load entry info via ajax
	AjaxController.getPhoto(photoId, handleEditPhoto);

	// Hide the lightbox divs
	divOverlay = document.getElementById("overlay");
	divOverlay.style.display = 'none';
	divLightbox = document.getElementById("lightbox");
	divLightbox.style.display = 'none';
}



function handleEditPhoto(photo) {
	document.photoForm.id.value = photo.id;
	document.photoForm.entryId.value = photo.entry.id;
	document.photoForm.title.value = photo.title;
	document.photoForm.date.value = photo.formattedDate;
	document.photoForm.subject.value = photo.subject;
	document.photoForm.description.value = photo.description;
	showPhoto();
}



function deletePhoto(photoId) {
	// load entry info via ajax
	if (confirm("Are you sure you want to delete this photo?")) {
		document.location.href = "deletePhoto.do?photoId=" + photoId;
	}

}



function uploadPhoto(entryId) {
	document.photoForm.id.value = "";
	document.photoForm.entryId.value = entryId;
	document.photoForm.title.value = "";
	document.photoForm.date.value = getCurrentFormattedDate();
	document.photoForm.subject.value = "";
	document.photoForm.description.value = "";
	showPhoto();
}


function showPhoto() {
	openPopup("photo_div");
}

